package tichu_project252.CardClasses;

/**
 * Implements the simple cards of the game. 
 * Simple are the cards that are countable and have a suit.
 * 
 * <p> <b> Invariants: </b> 2<=intRepr<=14 , suit!=null, strRepr != null </p>
 *
 * @author Alexandra Barka, ΑΜ: 2867, login : barka.
 * @author Euaggelia Petauraki AM: 2875 login: petavraki.
 * @version %I%, %G%
 */
public class simpleCard extends Card {

    private String suit;

    /**
     *
     * Constructs a new simple card given the suit, the number and the name of
     * the Card.
     *
     * <p><b>Constructor: </b> simpleCard (int intRepr, String strRepr, String
     * suit) </p>
     *
     * <p><b>Precondition: </b> the suit, the number and name of the card are
     * valid. </p> <p><b>Postcondition: </b> Constructs a valid simple card </p>
     *
     * @param intRepr The int representation of the card
     * @param strRepr The string representation of the card
     * @param suit The suit of the card ("Jade", "Sword", "Pagoda", "Star")
     * @throws Exception Exception is thrown if the card names are invalid.
     */
    public simpleCard(int intRepr, String strRepr, String suit) throws Exception {
        super(intRepr, strRepr);
        this.suit = suit;
    }

    /**
     * Returns the suit of the card.
     *
     * <p> <b> Accessor: </b> getSuit() </p>
     *
     * <p><b> Precondition: </b> The card has suit </p> <p> <b> Postcondition:
     * </b> Returns the suit of the card.</p>
     *
     * @return The suit of the card
     */
    @Override
    public String getSuit() {
        return suit;
    }

     /**
     * Returns the representation of the card in a string.
     * 
     * <p> <b> Accessor: </b> toString()  </p> 
     * <p><b> Precondition: </b> The card is correctly constructed.</p> 
     * <p> <b> Postcondition: </b> Returns a string with the suit,  the intRepr and strRepr.</p>
     *
     * @return Therepresentation of the card
     */
    @Override
    public String toString() {
        String s = intRepr + strRepr + suit;
        return s;
    }

    /**
     * Sets the path Image of the simple Card.
     * 
     * * <p><b>Transformer(mutator):</b> LoadImage(String pathImage)</p>
     *
     * <p><b>Precondition: </b> </p> <p><b>Postcondition: </b>sets the path image of the image
     * </p>
     * @param pathImage the path of the image
     */
    @Override
    public void LoadImage(String pathImage)  {
        this.pathImage = pathImage + intRepr + suit + ".png";
    }
}
